<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>lib/cli.js - YUIDoc</title>
    <link rel="stylesheet" href="https://yui-s.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
    <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
    <link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
    <link rel="icon" href="../assets/favicon.ico">
    <script src="https://yui-s.yahooapis.com/combo?3.9.1/build/yui/yui-min.js"></script>
</head>
<body class="yui3-skin-sam">

<div id="doc">
    <div id="hd" class="yui3-g header">
        <div class="yui3-u-3-4">
                <h1><img src="../assets/css/logo.png" title="YUIDoc" width="117" height="52"></h1>
        </div>
        <div class="yui3-u-1-4 version">
            <em>API Docs for: 0.10.0</em>
        </div>
    </div>
    <div id="bd" class="yui3-g">

        <div class="yui3-u-1-4">
            <div id="docs-sidebar" class="sidebar apidocs">
                <div id="api-list">
                    <h2 class="off-left">APIs</h2>
                    <div id="api-tabview" class="tabview">
                        <ul class="tabs">
                            <li><a href="#api-classes">Classes</a></li>
                            <li><a href="#api-modules">Modules</a></li>
                        </ul>
                
                        <div id="api-tabview-filter">
                            <input type="search" id="api-filter" placeholder="Type to filter APIs">
                        </div>
                
                        <div id="api-tabview-panel">
                            <ul id="api-classes" class="apis classes">
                                <li><a href="../classes/CLI.html">CLI</a></li>
                                <li><a href="../classes/DocBuilder.html">DocBuilder</a></li>
                                <li><a href="../classes/DocParser.html">DocParser</a></li>
                                <li><a href="../classes/DocView.html">DocView</a></li>
                                <li><a href="../classes/Files.html">Files</a></li>
                                <li><a href="../classes/Help.html">Help</a></li>
                                <li><a href="../classes/Main.html">Main</a></li>
                                <li><a href="../classes/Options.html">Options</a></li>
                                <li><a href="../classes/Server.html">Server</a></li>
                                <li><a href="../classes/Utils.html">Utils</a></li>
                                <li><a href="../classes/YUIDoc.html">YUIDoc</a></li>
                            </ul>
                
                
                            <ul id="api-modules" class="apis modules">
                                <li><a href="../modules/yuidoc.html">yuidoc</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="yui3-u-3-4">
                <div id="api-options">
                    Show:
                    <label for="api-show-inherited">
                        <input type="checkbox" id="api-show-inherited" checked>
                        Inherited
                    </label>
            
                    <label for="api-show-protected">
                        <input type="checkbox" id="api-show-protected">
                        Protected
                    </label>
            
                    <label for="api-show-private">
                        <input type="checkbox" id="api-show-private">
                        Private
                    </label>
                    <label for="api-show-deprecated">
                        <input type="checkbox" id="api-show-deprecated">
                        Deprecated
                    </label>
            
                </div>
            
            <div class="apidocs">
                <div id="docs-main">
                    <div class="content">
<h1 class="file-heading">File: lib/cli.js</h1>

<div class="file">
    <pre class="code prettyprint linenums">
#!/usr/bin/env node
&#x27;use strict&#x27;;

/**
 * Copyright (c) 2011, Yahoo! Inc. All rights reserved.
 * Code licensed under the BSD License:
 * https://github.com/yui/yuidoc/blob/master/LICENSE
 */

/**
 * Parses the arguments, creates the options and passes them to &#x60;Y.YUIDoc&#x60; and then &#x60;Y.DocBuilder&#x60;.
 * @class CLI
 * @module yuidoc
 */

var Y = require(&#x27;./index&#x27;);

var options = Y.Options(Y.Array(process.argv, 2));

Y.log(&#x27;Starting YUIDoc@&#x27; + Y.packageInfo.version + &#x27; using YUI@&#x27; + Y.version + &#x27; with NodeJS@&#x27; + process.versions.node, &#x27;info&#x27;, &#x27;yuidoc&#x27;);

var starttime = (new Date()).getTime();

options = Y.Project.init(options);

Y.log(&#x27;Starting YUIDoc with the following options:&#x27;, &#x27;info&#x27;, &#x27;yuidoc&#x27;);
var opts = Y.clone(options);
if (opts.paths &amp;&amp; opts.paths.length &amp;&amp; (opts.paths.length &gt; 10)) {
    opts.paths = [].concat(opts.paths.slice(0, 5), [&#x27;&lt;paths truncated&gt;&#x27;], options.paths.slice(-5));
}
Y.log(opts, &#x27;info&#x27;, &#x27;yuidoc&#x27;);

if (options.server) {
    Y.Server.start(options);
} else {
    var json = (new Y.YUIDoc(options)).run();
    if (json === null) {
        throw new Error(&#x27;Running YUIDoc returns null.&#x27;);
    }
    options = Y.Project.mix(json, options);

    if (!options.parseOnly) {
        var builder = new Y.DocBuilder(options, json);
        builder.compile(function () {
            var endtime = (new Date()).getTime();
            Y.log(&#x27;Completed in &#x27; + ((endtime - starttime) / 1000) + &#x27; seconds&#x27;, &#x27;info&#x27;, &#x27;yuidoc&#x27;);
        });
    }
}

    </pre>
</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="../assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src="../assets/js/yui-prettify.js"></script>
<script src="../assets/../api.js"></script>
<script src="../assets/js/api-filter.js"></script>
<script src="../assets/js/api-list.js"></script>
<script src="../assets/js/api-search.js"></script>
<script src="../assets/js/apidocs.js"></script>
</body>
</html>
